import React from 'react'
import { connect } from 'react-redux';

function City(props) {
  var list = ['北京','上海','广州','深圳','通辽'];
  return (
    <ul>
        {list.map(item =>
            <li key={item} onClick={()=>{
                props.changeCity(item);
                props.history.goBack();
            }}>{item}</li>)}
    </ul>
  )
}

const changeDispatchToProps = {
  changeCity(item){
    return {
      type:'change-city',
      value:item
    }
  }
}

export default connect(null, changeDispatchToProps)(City)